package com.softa.web.test.config;

import com.softa.common.sysconfig.properties.AuthorSettingsProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by yangl on 2018/4/21.
 */
@Configuration
//@EnableConfigurationProperties(AuthorSettingsProperties.class)
@ConditionalOnClass(HelloService.class)
public class HelloServiceAutoConfiguration {

    @Autowired
    private AuthorSettingsProperties authorSettings;

    @Bean
    @ConditionalOnMissingBean(HelloService.class)
    public HelloService helloService(){
        HelloService helloService = new HelloService();
        helloService.setName(authorSettings.getName()+"-configuration");
        return helloService;
    }

}
